class Release1 < ActiveRecord::Migration
  def self.up

    create_table :buckets, :force => true do |t|
      t.string :name, :null => false
      t.timestamps
    end

    create_table :setting_usages, :force => true do |t|
      t.references :bucket, :null => false
      t.references :setting, :null => false
      t.timestamps
    end

    create_table :settings, :force => true do |t|
      t.string :name, :null => false
      t.string :value
      t.timestamps
    end

    create_table :setting_overrides, :force => true do |t|
      t.string :value, :null => false
      t.references :setting
      t.timestamps
    end

    create_table :axes, :force => true do |t|
      t.string :name, :null => false
      t.integer :position
      t.timestamps
    end

    create_table :axis_values, :force => true do |t|
      t.string :name, :null => false
      t.references :axis
      t.timestamps
    end

    create_table :axis_value_usages, :force => true do |t|
      t.references :axis_value
      t.references :setting_override
      t.timestamps
    end

  end

  def self.down
    drop_table :buckets
    drop_table :setting_usages
    drop_table :settings
    drop_table :setting_overrides
    drop_table :axes
    drop_table :axis_values
    drop_table :axis_value_usages
  end
end
